package com.shensi.api.pay.pojo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.sql.Time;
import java.util.Calendar;
import java.util.Date;

/**
 * 客户端电子会员卡充值优惠设置明细
 */

@Data
public class CustomerCardSettingDetail {
    public static final String ACTIVITYTYPE_COUPON="coupon";
    public static final String ACTIVITYTYPE_BALANCE="balance";
    public static final String ACTIVITYTYPE_INTEGRAL="integral";

    public static final String ACTIVITY_MODE_RECHARGE="recharge";

    public static final String ACTIVITY_MODE_CONSUME="consume";

    public static final String according_to_litres="litres";
    public static final String according_to_money="amount";

    public static final String periodType_week = "week";
    public static final String periodType_month = "month";

    private Integer cardSettingDetailId;    //规则明细ID
    private Integer parentId;       //所对应电子会员卡ID
    private String settingRuleType;     //设置充值优惠类型：1，按赠送金额；2，按赠送比例
    private BigDecimal discountAmtStart;     //优惠条件金额起始值
    private BigDecimal discountAmtEnd;     //优惠条件金额结束值
    private BigDecimal presentAmt;          //赠送金额值或者赠送c充值金额的比例
    private String  cardType;           //电子卡类型
    private String status;              //状态
    private String delFlag;
    private Long enterpriseId;
    private Long stationId;

    //活动类型 电子卡余额balance/优惠卷coupon
    private String activityType;
    private String payType;

    private String activityMode;

    //按升数 litres /按金额 amount
    private String accordingTo;

    private BigDecimal amt ;//金额

    @ApiModelProperty("时段类型      全部时段 all/按周选择 week/按月选择 month")
    private String periodType;
    @ApiModelProperty("按周选择   1,2,3,4,5,6,7")
    private String weeklySelection;
    @ApiModelProperty("按月选择  1,2,3......,31")
    private String monthlySelection;
    @ApiModelProperty("周生效时间开始")
    private Time weekEffectiveTimeStart;
    @ApiModelProperty("周生效时间结束")
    private Time weekEffectiveTimeEnd;
    @ApiModelProperty("月生效时间开始")
    private Time monthEffectiveTimeStart;
    @ApiModelProperty("月生效时间结束")
    private Time monthEffectiveTimeEnd;
    private Date nowDate;

    public static String dateToWeek(Date date) {
        Calendar cal = Calendar.getInstance(); // 获得一个日历
        Date datet = date;
        cal.setTime(datet);
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1; // 指示一个星期中的某天。
        if (w < 0)
            w = 0;
        return w+"";
    }

    public static String dateToMonth(Date date){
        Calendar calendar = Calendar.getInstance();

        // 获取今天的日份
        int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);

        return dayOfMonth+"";
    }
}
